<%--
  Created by IntelliJ IDEA.
  User: z5727
  Date: 2022/9/20
  Time: 16:20
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<c:set value="${pageContext.request.contextPath}" var="path"></c:set>
<!doctype html>
<html lang="en" class="pxp-root">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <link rel="shortcut icon" href="/static/web/images/favicon.png" type="image/x-icon">
    <link rel="preconnect" href="https://fonts.googleapis.com/">
    <link rel="preconnect" href="https://fonts.gstatic.com/" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;500;600;700&display=swap" rel="stylesheet">
    <link href="/static/web/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="/static/web/css/font-awesome.min.css">
    <link rel="stylesheet" href="/static/web/css/owl.carousel.min.css">
    <link rel="stylesheet" href="/static/web/css/owl.theme.default.min.css">
    <link rel="stylesheet" href="/static/web/css/animate.css">
    <link rel="stylesheet" href="/static/web/css/style.css">

    <title>个人中心首页</title>
</head>
<body style="background-color: var(--pxpSecondaryColorLight);">
<jsp:include page="/web/personal/inc/personalCenterHead"></jsp:include>

    <div class="pxp-dashboard-content-details">
        <h1>个人主页</h1>
        <p class="pxp-text-light">欢迎您!</p>

        <div class="row mt-4 mt-lg-5 align-items-center">
            <div class="col-sm-6 col-xxl-3">
                <div class="pxp-dashboard-stats-card bg-primary bg-opacity-10 mb-3 mb-xxl-0">
                    <div class="pxp-dashboard-stats-card-icon text-primary">
                        <span class="fa fa-file-text-o"></span>
                    </div>
                    <div class="pxp-dashboard-stats-card-info">
                        <div class="pxp-dashboard-stats-card-info-number">${requestScope.numOfApplication}</div>
                        <div class="pxp-dashboard-stats-card-info-text pxp-text-light">工作申请</div>
                    </div>
                </div>
            </div>
            <div class="col-sm-6 col-xxl-3">
                <div class="pxp-dashboard-stats-card bg-success bg-opacity-10 mb-3 mb-xxl-0">
                    <div class="pxp-dashboard-stats-card-icon text-success">
                        <span class="fa fa-user-circle-o"></span>
                    </div>
                    <div class="pxp-dashboard-stats-card-info">
                        <div class="pxp-dashboard-stats-card-info-number">312</div>
                        <div class="pxp-dashboard-stats-card-info-text pxp-text-light">个人资料访问</div>
                    </div>
                </div>
            </div>
            <div class="col-sm-6 col-xxl-3">
                <div class="pxp-dashboard-stats-card bg-warning bg-opacity-10 mb-3 mb-xxl-0">
                    <div class="pxp-dashboard-stats-card-icon text-warning">
                        <span class="fa fa-envelope-o"></span>
                    </div>
                    <div class="pxp-dashboard-stats-card-info">
                        <div class="pxp-dashboard-stats-card-info-number">14</div>
                        <div class="pxp-dashboard-stats-card-info-text pxp-text-light">未读信息</div>
                    </div>
                </div>
            </div>
            <div class="col-sm-6 col-xxl-3">
                <div class="pxp-dashboard-stats-card bg-danger bg-opacity-10 mb-3 mb-xxl-0">
                    <div class="pxp-dashboard-stats-card-icon text-danger">
                        <span class="fa fa-bell-o"></span>
                    </div>
                    <div class="pxp-dashboard-stats-card-info">
                        <div class="pxp-dashboard-stats-card-info-number">${requestScope.numOfNotice}</div>
                        <div class="pxp-dashboard-stats-card-info-text pxp-text-light">未读通知</div>
                    </div>
                </div>
            </div>
        </div>

        <div class="row mt-4 mt-lg-5">
            <div class="col-xl-6">
                <h2>个人资料访问</h2>
                <div class="mt-3 mt-lg-4 pxp-dashboard-chart-container">
                    <div class="row justify-content-between align-content-center mb-4">
                        <div class="col-auto">
                            <span class="pxp-dashboard-chart-value">154</span><span class="pxp-dashboard-chart-percent text-success"><span class="fa fa-long-arrow-up"></span> 34%</span><span class="pxp-dashboard-chart-vs">vs 过去7天</span>
                        </div>
                        <div class="col-auto">
                            <select class="form-select">
                                <option value="-7 days">过去  7  天</option>
                                <option value="-30 days">过去  30  天</option>
                                <option value="-60 days">过去  60  天</option>
                                <option value="-90 days">过去  90  天</option>
                                <option value="-12 months">过去  12  月</option>
                            </select>
                        </div>
                    </div>
                    <canvas id="pxp-candidate-dashboard-visits-chart"></canvas>
                </div>
            </div>
            <div class="col-xl-6">
                <h2 class="mt-4 mt-lg-5 mt-xl-0">应用</h2>
                <div class="mt-3 mt-lg-4 pxp-dashboard-chart-container">
                    <div class="row justify-content-between align-content-center mb-4">
                        <div class="col-auto">
                            <span class="pxp-dashboard-chart-value">280</span><span class="pxp-dashboard-chart-percent text-success"><span class="fa fa-long-arrow-up"></span> 56%</span><span class="pxp-dashboard-chart-vs">vs 过去 7 天</span>
                        </div>
                        <div class="col-auto">
                            <select class="form-select">
                                <option value="-7 days">过去  7  天</option>
                                <option value="-30 days">过去  30  天</option>
                                <option value="-60 days">过去  60  天</option>
                                <option value="-90 days">过去  90  天</option>
                                <option value="-12 months">过去  12  月</option>
                            </select>
                        </div>
                    </div>
                    <canvas id="pxp-candidate-dashboard-app-chart"></canvas>
                </div>
            </div>
        </div>

        <div class="row mt-4 mt-lg-5">
            <div class="col-xxl-6">
                <h2>最近通知</h2>
                <div class="pxp-candidate-dashboard-notifications">
                    <c:forEach items="${requestScope.notices.list}" var="notice">
                        <div class="pxp-candidate-dashboard-notifications-item mb-3">
                            <div class="pxp-candidate-dashboard-notifications-item-left">
                                <div class="pxp-candidate-dashboard-notifications-item-type"><span class="fa fa-user-circle-o"></span></div>
                                <div class="pxp-candidate-dashboard-notifications-item-message">
                                    <a href="/web/personal/personalCompanyDetail/${notice.company.id}">${notice.company.name}</a> ${notice.noticeMode.noticeInfo}
                                </div>
                            </div>
                            <div class="pxp-candidate-dashboard-notifications-item-right"></div>
                            <input type="hidden" class="noticeTime" value="<fmt:formatDate value='${notice.noticeTime}' pattern='yyyy-MM-dd HH:mm:ss'/>">
                        </div>
                    </c:forEach>
                </div>
            </div>
            <div class="col-xxl-6">
                <h2 class="mt-4 mt-lg-5 mt-xxl-0">最新消息</h2>
                <div class="pxp-candidate-dashboard-messages">
                    <div class="pxp-candidate-dashboard-messages-item mb-3">
                        <div class="pxp-candidate-dashboard-messages-item-avatar pxp-cover" style="background-image: url(/static/web/images/company-logo-1.png);"></div>
                        <div class="pxp-candidate-dashboard-messages-item-details ms-3">
                            <div class="pxp-candidate-dashboard-messages-item-name">Artistre Studio</div>
                            <div class="pxp-candidate-dashboard-messages-item-date pxp-text-light">Oct 6, 2021 at 8:04 pm</div>
                            <p class="mt-1 mb-0">Lorem Ipsum is also known as: Greeked text, blind text, placeholder text, dummy content, filler text, lipsum, and mock-content.</p>
                        </div>
                    </div>
                    <div class="pxp-candidate-dashboard-messages-item mb-3">
                        <div class="pxp-candidate-dashboard-messages-item-avatar pxp-cover" style="background-image: url(/static/web/images/company-logo-2.png);"></div>
                        <div class="pxp-candidate-dashboard-messages-item-details ms-3">
                            <div class="pxp-candidate-dashboard-messages-item-name">Craftgenics</div>
                            <div class="pxp-candidate-dashboard-messages-item-date pxp-text-light">Oct 6, 2021 at 8:04 pm</div>
                            <p class="mt-1 mb-0">In publishing and graphic design, lorem ipsum is a filler text or greeking commonly used to demonstrate the textual elements of a graphic document or visual presentation.</p>
                        </div>
                    </div>
                    <div class="pxp-candidate-dashboard-messages-item mb-3">
                        <div class="pxp-candidate-dashboard-messages-item-avatar pxp-cover" style="background-image: url(/static/web/images/company-logo-3.png);"></div>
                        <div class="pxp-candidate-dashboard-messages-item-details ms-3">
                            <div class="pxp-candidate-dashboard-messages-item-name">Illuminate Studio</div>
                            <div class="pxp-candidate-dashboard-messages-item-date pxp-text-light">Oct 6, 2021 at 8:04 pm</div>
                            <p class="mt-1 mb-0">Replacing meaningful content with placeholder text allows designers to design the form of the content before the content itself has been produced.</p>
                        </div>
                    </div>
                    <div class="pxp-candidate-dashboard-messages-item mb-3">
                        <div class="pxp-candidate-dashboard-messages-item-avatar pxp-cover" style="background-image: url(/static/web/images/company-logo-4.png);"></div>
                        <div class="pxp-candidate-dashboard-messages-item-details ms-3">
                            <div class="pxp-candidate-dashboard-messages-item-name">Syspresoft</div>
                            <div class="pxp-candidate-dashboard-messages-item-date pxp-text-light">Oct 6, 2021 at 8:04 pm</div>
                            <p class="mt-1 mb-0">Lorem Ipsum is also known as: Greeked text, blind text, placeholder text, dummy content, filler text, lipsum, and mock-content.</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="mt-4 mt-lg-5">
            <h2>浏览职位记录</h2>
            <div class="table-responsive">
                <table class="table align-middle">
                    <c:forEach items="${requestScope.positionHistorys}" var="positionHistory">
                    <tr>
                        <td style="width: 3%;"><div class="pxp-candidate-dashboard-job-avatar pxp-cover" style="background-image: url(/static/images/${positionHistory.position.company.face});"></div></td>
                        <td style="width: 25%;">
                            <a href="/web/personal/positionDetail/${positionHistory.position.id}" target="_blank">
                            <div class="pxp-candidate-dashboard-job-title">${positionHistory.position.positionName}</div>
                            <div class="pxp-candidate-dashboard-job-company">${positionHistory.position.company.name}</div>
                            </a>
                        </td>
                        <td style="width: 25%;"><div class="pxp-candidate-dashboard-job-category">${positionHistory.position.positionTypeSecond.typeName}</div></td>
                        <td style="width: 25%;"><div class="pxp-candidate-dashboard-job-location"><span class="fa fa-globe"></span>${positionHistory.position.company.province.provName}  ${positionHistory.position.company.city.cityName}</div></td>
                        <td style="width: 10%;"><div class="pxp-candidate-dashboard-job-type"><fmt:formatDate value="${positionHistory.browsingTime}" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate></div></td>
                        <td>
                            <div class="pxp-dashboard-table-options">
                                <ul class="list-unstyled">
                                    <li><button title="View job details"><span class="fa fa-eye"></span></button></li>
                                </ul>
                            </div>
                        </td>
                    </tr>
                    </c:forEach>
                </table>
            </div>
        </div>
    </div>

    <footer>
        <div class="pxp-footer-copyright pxp-text-light">© 2021 Jobster. All Right By <a href="http://www.bootstrapmb.com/">bootstrapmb</a>.</div>
    </footer>
</div>

<script src="/static/web/js/jquery-3.4.1.min.js"></script>
<script src="/static/web/js/bootstrap.bundle.min.js"></script>
<script src="/static/web/js/owl.carousel.min.js"></script>
<script src="/static/web/js/nav.js"></script>
<script src="/static/web/js/Chart.min.js"></script>
<script src="/static/web/js/main.js"></script>
</body>
</html>

<script>
    $(function (){
        $(".noticeTime").each(function (){
            let noticeTime = $(this).val();
            let nowTime = new Date().getTime();
            let oldTime = new Date(noticeTime).getTime();
            let time = nowTime - oldTime;
            let minute = parseInt(time/1000/60%60);
            let hour = parseInt(time/1000/60/60%24);
            let day = parseInt(time/1000/60/60/24%30);
            let info = "";
            if (minute<1&&hour<1&&day<1)
            {
                info = "刚刚";
                $(this).prev().html(info);
                return;
            }
            info = "前"
            if (minute>=1) {
                info = minute + "分钟" +info;
            }
            if (hour>=1)
            {
                info = hour+"小时"+info;
            }
            if (day>=1)
            {
                info = day+"天"+info;
            }
            $(this).prev().html(info);
        });
    });
</script>
